/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>
#include <unordered_map>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

using ll = long long;

constexpr int maxn = 3e5 + 2, maxk = maxn, mod = 998244853;

int ecnt;
int heads[maxn];

struct Edge {
  int v, nxt, d;
} e[maxn * 2];

inline void add(int u, int v, int d) {
  e[++ecnt].v = v, e[ecnt].nxt = heads[u], heads[u] = ecnt, e[ecnt].d = d;
}

std::vector<int> path;
std::unordered_map<int, int> f[maxn];

ll pow[maxk];

ll qpow(ll base, int exp) {
  ll res = 1;
  while (exp) {
    if (exp & 1) res = res * base % mod;
    base = base * base % mod;
    exp >>= 1;
  }
  return res;
}

ll inv[maxn];

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    int u, v, d;
    cin >> u >> v >> d;
    add(u, v, d), add(v, u, d);
  }
  for (int i = 1; i <= k; ++i) {
    int tmp;
    cin >> tmp;
    path.push_back(tmp);
  }
  inv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    inv[i] = (ll)(mod - mod / i) * inv[mod % i] % mod;
  }
  pow[0] = 1;
  for (int i = 1; i <= k; ++i) {
    pow[i] = pow[i - 1] * 10 % mod;
  }
  int u = path.front();
  ll ans = 0;
  bool flag = true;
  for (int i = 1; i < k; ++i) {
    int t = path[i];
    auto iter = f[u].find(t);
    if (iter != f[u].end()) {
      ans += pow[k - i - 1] * (iter->second) % mod;
      if (ans >= mod) ans -= mod;
      u = t;
      continue;
    }
    int cnt = 0;
    ll add = 0;
    for (int i = heads[u]; i; i = e[i].nxt) {
      int v = e[i].v;
      if (v == t) {
        ++cnt;
        add += e[i].d;
        add %= mod;
      }
    }
    if (cnt == 0) {
      flag = false;
      break;
    }
    ll tmp = add * inv[cnt] % mod;
    f[u][t] = tmp;
    f[t][u] = tmp;
    u = t;
    ans += pow[k - i - 1] * tmp % mod;
    if (ans >= mod) ans -= mod;
  }
  if (flag)
    cout << ans;
  else
    cout << "Stupid Msacywy!";
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("H. Visit the Park.in", "r", stdin);
  freopen("H. Visit the Park.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
